﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IrishSettings;

namespace SampleWebForms
{
    public partial class ApplicationTwo : System.Web.UI.Page
    {
        public class FrenchSettings : SettingsApplication
        {
            public FrenchSettings()
            {
                Construct(new Version(1, 0));
            }

            public FrenchSettings(Version v)
            {
                Construct(v);
            }

            private void Construct(Version v)
            {
                Application = "FrenchApp";
                CultureObject = new CultureInfo("fr-FR");
                VersionObject = v;
                Schema.ValidateAndAdd("culture", Schema.StringItem("culture", "fr-FR", CultureObject)); //is-is
                Schema.ValidateAndAdd("timezone", Schema.StringItem("timezone", "PST", CultureObject));
                Schema.ValidateAndAdd("favoriteColor", Schema.StringItem("favoriteColor", "rouge", CultureObject));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                IrishSettingsManager m1 = new IrishSettingsManager(new FrenchSettings());
                m1.Save();
                this.CurrentSettings.DataSource = m1.Enumeration();
                CurrentSettings.DataBind();
            }
        }
    }
}